﻿#ifndef LGAPACKAGEMANAGER_H
#define LGAPACKAGEMANAGER_H

#include "singleton.h"
#include <QString>
#include <QHash>
#include <QSettings>
#include <QCoreApplication>
class LgaPackageManager : public Singleton<LgaPackageManager>
{
public:

	typedef struct _POD_INFO {
		QList<QPointF> padsPosList1;
		QList<QPointF> padsPosList2;
		QList<QPointF> padsPosList3;
		QList<QPointF> padsPosList4;
		QPointF padsCenter1;
		QPointF padsCenter2;
		QPointF padsCenter3;
		QPointF padsCenter4;
		QList<QPointF> capsPosList1;
		QPointF capsCenter1;
	}POD_INFO;

	//typedef struct _LIGHT_INFO
	//{
	//	QString name;
	//	QString color;
	//}LIGHT_INFO;

	//typedef struct _LIGHT_CONFIG
	//{
	//	int brightness1;
	//	int brightness2;
	//	int catchProp;
	//}LIGHT_CONFIG;

	//typedef struct _PACKAGE_INFO
	//{
	//	int padNumbers;
	//	int capNumbers;
	//	int multiErrorCode;

	///*	double erosionWidth;
	//	double erosionHeight;*/

	//	LIGHT_CONFIG lightConfigPad;
	//	LIGHT_CONFIG lightConfigCap;
	//	LIGHT_CONFIG lightConfigSubstrate;

	//	int xCnt;
	//	int yCnt;
	//	int xOffset;
	//	int yOffset;

	//}PACKAGE_INFO;

	typedef struct _INSPECT_PARAM {
		bool bBypass;
		bool bPadDamaged;
		bool bChipping;
		bool bCapDamaged;

		bool bDisColor;
		int discolorValue;
		double miniChippingArea;
		double miniChippingWidth;
		double miniChippingHeight;

		int miniAreaRatio;
		int miniCountOfLarge;

		int saveDays;
		bool bOnlySaveFail;

		bool bSeperateFolder;
		int iCountForSeperateFolder;

		int capMiniAreaRatio;
	/*	int xCnt;
		int yCnt;
		int xOffset;
		int yOffset;*/

	}INSPECT_PARAM;

	//PACKAGE_INFO GetPackageInfo();
	//PACKAGE_INFO GetPackageInfoFromFile();
	
	void SavePodToFile(LgaPackageManager::POD_INFO p);
	LgaPackageManager::POD_INFO GetPodFromFile();

	void SaveParamToFile(INSPECT_PARAM param);
	INSPECT_PARAM GetParamFromFile();
	//void setPackageType(QString type)
	//{
	//	m_type = type;
	//}

	QString getPackageType()
	{
		QString appName = QCoreApplication::applicationName();
		QSettings app(appName, "Config");
		m_type = app.value("Package").toString();
		//app.setValue("Package", ui->comboBox->currentText());
		return m_type;
	}

protected:
	QString m_type;
	friend class Singleton<LgaPackageManager>;
	LgaPackageManager();
};

#endif // LGAPACKAGEMANAGER_H
